package com.example.communitypro.config;


import com.example.communitypro.CommunityproApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/*
 * 资源映射路径
 */

@Configuration
public class ImageConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        if(CommunityproApplication.isWindows)
            registry.addResourceHandler("/image/**").addResourceLocations("file:C:/image/");
        else
            registry.addResourceHandler("/image/**").addResourceLocations("file:/home/atipiu/images/");

        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }

}

